<template>
  <div class="home">
    <div>son home {{ getEmitData }}</div>
    <div class="back" @click="toParent">返回父路由Home</div>
    <img alt="Vue logo" src="../assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
import { getSpaStore } from 'xu-rabin-event'
export default {
  name: 'Home',
  components: {
    HelloWorld,
  },
  data() {
    return {
      getEmitData: '测试数据',
    }
  },
  mounted() {
    const that = this

    getSpaStore().on('PARENT_PATH', (param) => {
      console.log('-onPARENT_PATH--2222-', param)
      that.getEmitData = param
    })
  },
  methods: {
    toParent() {
      getSpaStore().emit('parentPath', '/about')
    },
  },
}
</script>
<style scoped>
.back {
  height: 40px;
  width: 100px;
  background: gray;
  border-radius: 20px;
  color: aliceblue;
  cursor: pointer;
}
</style>
